<template>

<!-- <el-backtop target=".page-component__scroll .el-scrollbar__wrap"> -->
  <div class="zuida demo-image__lazy" ref='zuida'>
    <!-- <el-backtop target=".page-component__scroll .el-scrollbar__wrap"></el-backtop> -->
    <!-- <div class="paihang"></div> -->
    <div class="paihang1" ref="tips" @click="tianjia"><i class="el-icon-plus"></i></div>
    <div class="zuo"></div>
    <div class="you">
      <div v-for='(item,index) in list' :key="index" class="dan">
        <div class="tou">
          <!-- <img src="https://ts1.cn.mm.bing.net/th/id/R-C.fd81516a06ce33c15b194494272fa6e9?rik=XAfnJ6A9NFvAyA&riu=http%3a%2f%2fimg.touxiangwu.com%2fuploads%2fallimg%2f2022053117%2fivhiashhpu1.jpg&ehk=Yi2aDhWvd0rnBKl1xloJy8F1RfGd8%2bcC75k4ff8dVXk%3d&risl=&pid=ImgRaw&r=0" alt=""> -->
          <el-image 
    style="width: 50px; height: 50px"
    :src="item.tou" 
    :preview-src-list="[item.tou]" lazy>
  </el-image>
          <div class="name">{{item.user}}<br>{{item.date}}</div>
          <div class="del"><i class="el-icon-delete-solid" @click="del(item.id)"></i></div>
        </div>
      <div class="title">{{item.title}} </div>
      <div >{{item.content}} </div>
      <div class="img">
        <div v-for="(itemimg,index1) in item.img" :key="index1" class="imgzong">
        <!-- <img :src="itemimg" alt=""> -->
        <el-image 
    :src="itemimg" 
    :preview-src-list="item.img" class="getu" lazy>
  </el-image>
        </div>
      </div>
      <!-- <div class="pinglun">
        <div class="icon"><i class="el-icon-chat-line-square"></i>11</div>
        <div class="icon"><i class="el-icon-lollipop"></i>111</div>
        <div class="icon"><i class="el-icon-star-off"></i>111</div>
       
      </div> -->
      <div class="pinglun">
        <div class="icon" @click="tiaoxiangxi(item.id)"><i class="el-icon-chat-line-square"></i>
        
        <!-- {{ping[item.id]}} -->
        <!-- {{pinglun(item.id)}} -->
        {{item.pinglun}}
        <!-- 11 -->
        </div>
        <!-- <div class="icon"><i class="el-icon-lollipop"></i>111</div> -->
        <div class="icon"><i class="el-icon-view"></i>{{item.liulan}}</div>
       
      </div>
    </div>
    <div class="kong" ref='kong'>
      <i class="el-icon-thumb" @click="tianjia"></i>您暂时还未发布任何文章,赶快去发布第一篇吧~
    </div>
    </div>
    <!-- <el-backtop target=".zuida"></el-backtop> -->
  </div>
  <!-- </el-backtop> -->
  
</template>
<script>
// import Tou from './zujian/shang.vue'
export default {
  components:{
    // Tou
  },
  data(){
    return {
      index:'4',
      list:[
        // {title:"我是第一个",img:['https://ts1.cn.mm.bing.net/th/id/R-C.94c6be369625327593f829d81011d741?rik=mepG4A3JqSSA2Q&riu=http%3a%2f%2fpic.bizhi360.com%2fbbpic%2f81%2f9681_1.jpg&ehk=nP%2bxA7dSghZamVig%2bvkLmhzLrEqz6MXEfRGhrAdJu1o%3d&risl=&pid=ImgRaw&r=0','https://pic2.zhimg.com/v2-6ae8d79dbf815fb51c9543fd62a4c2a9_r.jpg?source=1940ef5c','https://pic1.zhimg.com/v2-e54e0fd06046f00ae12f86e46bbb09f3_r.jpg?source=1940ef5c','https://tse1-mm.cn.bing.net/th/id/OIP-C.CygMdhWXRlx9sNIhN6Sc2wHaEo?w=1920&h=1200&rs=1&pid=ImgDetMain']},
        // {title:"我是第一个",img:['https://ts1.cn.mm.bing.net/th/id/R-C.94c6be369625327593f829d81011d741?rik=mepG4A3JqSSA2Q&riu=http%3a%2f%2fpic.bizhi360.com%2fbbpic%2f81%2f9681_1.jpg&ehk=nP%2bxA7dSghZamVig%2bvkLmhzLrEqz6MXEfRGhrAdJu1o%3d&risl=&pid=ImgRaw&r=0','https://pic2.zhimg.com/v2-6ae8d79dbf815fb51c9543fd62a4c2a9_r.jpg?source=1940ef5c','https://pic1.zhimg.com/v2-e54e0fd06046f00ae12f86e46bbb09f3_r.jpg?source=1940ef5c','https://tse1-mm.cn.bing.net/th/id/OIP-C.CygMdhWXRlx9sNIhN6Sc2wHaEo?w=1920&h=1200&rs=1&pid=ImgDetMain']},
        // {title:"我是第一个",img:['https://ts1.cn.mm.bing.net/th/id/R-C.94c6be369625327593f829d81011d741?rik=mepG4A3JqSSA2Q&riu=http%3a%2f%2fpic.bizhi360.com%2fbbpic%2f81%2f9681_1.jpg&ehk=nP%2bxA7dSghZamVig%2bvkLmhzLrEqz6MXEfRGhrAdJu1o%3d&risl=&pid=ImgRaw&r=0','https://pic2.zhimg.com/v2-6ae8d79dbf815fb51c9543fd62a4c2a9_r.jpg?source=1940ef5c','https://pic1.zhimg.com/v2-e54e0fd06046f00ae12f86e46bbb09f3_r.jpg?source=1940ef5c','https://tse1-mm.cn.bing.net/th/id/OIP-C.CygMdhWXRlx9sNIhN6Sc2wHaEo?w=1920&h=1200&rs=1&pid=ImgDetMain']},
        // {title:"我是第一个",img:['https://ts1.cn.mm.bing.net/th/id/R-C.94c6be369625327593f829d81011d741?rik=mepG4A3JqSSA2Q&riu=http%3a%2f%2fpic.bizhi360.com%2fbbpic%2f81%2f9681_1.jpg&ehk=nP%2bxA7dSghZamVig%2bvkLmhzLrEqz6MXEfRGhrAdJu1o%3d&risl=&pid=ImgRaw&r=0','https://pic2.zhimg.com/v2-6ae8d79dbf815fb51c9543fd62a4c2a9_r.jpg?source=1940ef5c','https://pic1.zhimg.com/v2-e54e0fd06046f00ae12f86e46bbb09f3_r.jpg?source=1940ef5c','https://tse1-mm.cn.bing.net/th/id/OIP-C.CygMdhWXRlx9sNIhN6Sc2wHaEo?w=1920&h=1200&rs=1&pid=ImgDetMain']},
      ],
      litop:0
    }
  },
  methods:{
    del(value){
      this.axios.get("/delwen/"+value).then((res)=>{
        this.$router.go(0)
      })
    },
    tianjia(){
      this.$router.push('/tianjia')
    },
    shuaxin(){
      console.log('刷新了');
    },
    tiaoxiangxi(val){
      this.axios.get('/kan/'+val).then((res)=>{
      // console.log(res);
    })
      this.$router.push('/wenzhang/'+val)
    },
  },
  mounted(){
    this.$store.commit('indexbian',this.index)
    // this.open()
    window.addEventListener('beforeunload', this.shuaxin);
    
  },
  beforeDestroy () {
      		window.removeEventListener('scroll', this.gundong)
    	},
created(){
      this.$store.commit('bianhui')
      var user=JSON.parse(window.sessionStorage.getItem("user"))

      // console.log(typeof user);
      this.axios.get('/wowen/'+user.use).then((res)=>{
        console.log(res.data);
        for(var i=0;i<res.data.length;i++){
          // console.log(res.data[i].img);
          res.data[i].img=eval(res.data[i].img)
          // var acc=JSON.parse(res.data[i].img)
          // console.log(res.data);
          
        } 
        this.list=res.data
        if(this.list.length===0){
          // console.log("111");
          this.$refs.kong.style.display='block'
        }
        else{
          this.$refs.kong.style.display='none'
        }
      })
      //每日文章数据统计
    var date=new Date()
      var yue=date.getMonth()+1
      var ri=date.getDate()
      // this.riqi=[yue+'月'+(ri-6)+"日",yue+'月'+(ri-5)+"日",yue+'月'+(ri-4)+"日",yue+'月'+(ri-3)+"日",yue+'月'+(ri-2)+"日",yue+'月'+(ri-1)+"日",yue+'月'+ri+"日"]
      var user=JSON.parse(sessionStorage.getItem('user'))
    var id=user.id
    this.axios.post('/sum',{
        idd:id,
        date:[yue+'/'+(ri-6),yue+'/'+(ri-5),yue+'/'+(ri-4),yue+'/'+(ri-3),yue+'/'+(ri-2),yue+'/'+(ri-1),yue+'/'+ri]
      }).then((res)=>{
        this.$store.commit('shubian',res.data)
        // console.log('hhhh');
        // console.log(this.$store.state.list);
      })
    }
}
</script>
<style lang="less" scoped>
.zuida{
    // overflow: scroll;
    // display: none;
    // overflow-y: scroll;
    width: 70%;
    margin: 0 auto;
    // height: 30000px;
    // background-color: red;
    margin-top: 40px;
    display: flex;
    justify-content:space-around;
    // background-color: red;
  }
  .zuo{
    width: 20%;
    // background-color: blue;
    // position:fixed;
    // top: 100px;
    // height: 100px;
  }
  .you{
    padding-top: 20px;
    width: 70%;
    background-color: #f1f1f1;
    // margin-left: 10px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 20px;
  }
  .dan{
    width: 100%;
    .img{
      width: 100%;
      display: flex;
      // background-color: blueviolet;
      flex-wrap:wrap;
      // justify-content:space-around;
      // margin-right: ;
      .imgzong{
        margin-left: 4px;
        display: flex;
        justify-content:center;
        width: 32%;
        border-radius: 20px;
        // overflow: hidden;
        height: 260px;
        overflow: hidden;
        
      }
      
    }
    .tou{
      position: relative;
      display: flex;
      color: #7b8084;
      margin-bottom: 10px;
      /deep/ .el-image{
        border-radius: 25px;
      }
    .name{
      margin-left: 20px;
      margin-top: 10px;
    }
  }
  .pinglun{
    margin-top: 10px;
  width: 100%;
  height: 34px;
  // background-color: rgb(95, 229, 77);
  display: flex;
  .icon{
    line-height: 34px;
    font-size: 18px;
    width: 30%;
    text-align: center;
  }
}
  }
  .paihang{
    width: 300px;
    height: 580px;
    background-color: #d4f1d5;
    border-radius: 10px;
    position: fixed;
    top: 130px;
    left: 280px;
  }
  .paihang1{
    width: 60px;
    height: 60px;
    background-color: #9be49e;
    border-radius: 40px;
    position: fixed;
    top: 360px;
    right: 150px;
    line-height: 60px;
    text-align: center;
    font-size: 32px;
  }
  /deep/ .getu{
          width: 100%;
          // height: 100%;
          // 
          
          img{
            width: 100%;
            // height: 50%;
            // display: block;
            object-fit: cover;
          }
        }
.title{
    color: #000000;
    font-size: 22px;
  }
  [v-cloak]{
    display: none;
  }
  .kong{
    width: 100%;
    height: 50px;
    // background-color: red;
    line-height: 50px;
    text-align: center;
    font-size: 20px;
  }
  .del{
    position: absolute;
    right: 50px;
    top:40px;
    font-size: 26px;
    width: 30px;
    height: 30px;
    // background-color: red;
  }
//   .zuida{
//     // overflow: scroll;
//     // display: none;
//     // overflow-y: scroll;
//     width: 70%;
//     margin: 0 auto;
//     // height: 30000px;
//     // background-color: red;
//     margin-top: 40px;
//     display: flex;
//     justify-content:space-around;
//     // background-color: red;
//   }
//   .zuo{
//     width: 20%;
//     // background-color: blue;
//     // position:fixed;
//     // top: 100px;
//     // height: 100px;
//   }
//   .you{
//     padding-top: 20px;
//     width: 70%;
//     background-color: #f1f1f1;
//     // margin-left: 10px;
//     padding-left: 20px;
//     padding-right: 20px;
//     border-radius: 20px;
//   }
//   .dan{
//     width: 100%;
//     .img{
//       width: 100%;
//       display: flex;
//       // background-color: blueviolet;
//       flex-wrap:wrap;
//       // justify-content:space-around;
//       // margin-right: ;
//       .imgzong{
//         margin-left: 4px;
//         display: flex;
//         justify-content:center;
//         width: 32%;
//         border-radius: 20px;
//         // overflow: hidden;
//         height: 260px;
//         overflow: hidden;
        
//       }
      
//     }
//     .tou{
//       display: flex;
//       color: #7b8084;
//       margin-bottom: 10px;
//       img{
//         width: 50px;
//         // height: 50px;
//         border-radius: 25px;
//         overflow: hidden;
//       }
//     .name{
//       margin-left: 20px;
//       margin-top: 10px;
//     }
//   }
//   .pinglun{
//     margin-top: 10px;
//   width: 100%;
//   height: 34px;
//   // background-color: rgb(95, 229, 77);
//   display: flex;
//   .icon{
//     line-height: 34px;
//     font-size: 18px;
//     width: 30%;
//     text-align: center;
//   }
// }
//   }
//   // .paihang{
//   //   width: 300px;
//   //   height: 580px;
//   //   background-color: #d4f1d5;
//   //   border-radius: 10px;
//   //   position: fixed;
//   //   top: 130px;
//   //   left: 280px;
//   // }
//   .paihang1{
//     width: 80px;
//     height:80px;
//     text-align: center;
//     line-height: 80px;
//     background-color: #9cef9e;
//     border-radius: 40px;
//     position: fixed;
//     top: 550px;
//     right: 180px;
//     font-size: 40px;
//   }
//   /deep/ .getu{
//           width: 100%;
//           // height: 100%;
//           // 
          
//           img{
//             width: 100%;
//             // height: 50%;
//             // display: block;
//             object-fit: cover;
//           }
//         }

</style>